package com.lagou.rabbitmq.controller;

import com.lagou.rabbitmq.entity.OrderEntity;
import com.lagou.rabbitmq.service.OrderService;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
public class OrderController {

    @Autowired
    private OrderService orderService;

    @PostMapping("/order")
    public String order() {
        return orderService.order();
    }

    @PostMapping("/pay")
    public boolean pay(String orderNumber){
        return orderService.pay(orderNumber);
    }

    @GetMapping("cancel-orders")
    public List<OrderEntity> cancelOrders(){
        return orderService.cancelOrders();
    }

}
